<script>

// 放弃到公海modal
function giveupToOcean(uid) {
    $("#giveup_to_ocean_uid").val(uid);
    $('#giveupToOceanModal').modal();
}

// 资料收集完成modal
function collectDone(uid) {
    $("#collect_done_uid").val(uid);
    $('#collectDoneModal').modal();
}

// 审核再申请modal
function auditReApply(uid) {
    $("#audit_reapply_uid").val(uid);
    $('#auditReApplyModal').modal();
}

// 收集会籍经理modal
function assignMemship(uid, memshiId) {
    $("#memship_uid").val(uid);
    $("#memship_person_id").val(memshiId);
    $('#modifyMemshipPerModal').modal();
}


$(function(){

    // 放弃到公海
    $("#giveup_to_ocean").click(function(){
        var uid = $("#giveup_to_ocean_uid").val();
        
        cAjax({
                    url:  "/crm/potential/toOcean",
                    data: {uid:uid},
                    success: function(data){
                                if(data.result) {
                                     $('#giveupToOceanModal').modal('hide');
                                    greeting({msg:"操作成功！", confirm:function(){
                                        location.reload();
                                    }});                                
                                } else {
                                    greeting({msg:"<h4 style=\"color:red\">失败，有错误！</h4>",title:"操作失败"});
                                }
                     },
                    error: function(obj) {
                    }
        });    
        
    });
    
    // 资料收集完成
    $("#collect_done_save").click(function(){
        var uid = $("#collect_done_uid").val();
        
         cAjax({
                    url:  "/crm/potential/collectDone",
                    data: {uid:uid},
                    success: function(data){
                                if(data.result) {
                                     $('#collectDoneModal').modal('hide');
                                    greeting({msg:"操作成功！", confirm:function(){
                                        location.reload();
                                    }});                                
                                } else {
                                    greeting({msg:"<h4 style=\"color:red\">失败，有错误！</h4>",title:"操作失败"});
                                }
                     },
                    error: function(obj) {
                    }
        }); 
      
    });
    
    // 申请再审核
    $("#audit_reapply_save").click(function(){        
        var uid = $("#audit_reapply_uid").val();
        
         cAjax({
                    url:  "/crm/potential/auditReApply",
                    data: {uid:uid},
                    success: function(data){
                                if(data.result) {
                                     $('#auditReApplyModal').modal('hide');
                                    greeting({msg:"操作成功！", confirm:function(){
                                        location.reload();
                                    }});                                
                                } else {
                                    greeting({msg:"<h4 style=\"color:red\">失败，有错误！</h4>",title:"操作失败"});
                                }
                     },
                    error: function(obj) {
                    }
        }); 
        
    });
    
    // 修改会籍经理
    $("#save_memship").click(function(){
        var uid = $("#memship_uid").val();
        var memshipId = $("#memship_person_id").val();
        
         cAjax({
                    url:  "/crm/ocean/assignMemship",
                    data: {uid:uid,memshipId:memshipId},
                    success: function(data){
                                if(data.result) {
                                     $('#modifyMemshipPerModal').modal('hide');
                                    greeting({msg:"操作成功！", confirm:function(){
                                        location.reload();
                                    }});                                
                                } else {
                                    greeting({msg:"<h4 style=\"color:red\">失败，有错误！</h4>",title:"操作失败"});
                                }
                     },
                    error: function(obj) {
                    }
        }); 

    });
    
});

</script>